<?php 

class App_Form_Decorator_FieldLabel extends Zend_Form_Decorator_Abstract
{
	public function buildLabel()
    {
        $element = $this->getElement();
        $label = $element->getLabel();
        if ($translator = $element->getTranslator()) {
            $label = $translator->translate($label);
        }
        $label .= ':';
        return $label;
    }    

	public function buildInput()
    {
        $element = $this->getElement();
        $helper  = $element->helper;
        return $element->getValue();
    }

    public function buildDescription()
    {
        $element = $this->getElement();
        $desc    = $element->getDescription();
        if (empty($desc)) {
            return '';
        }
        return '<div class="description">' . $desc . '</div>';
    }

	public function render($content)
    {
        $element = $this->getElement();
        if (!$element instanceof Zend_Form_Element) {
            return $content;
        }
        if (null === $element->getView()) {
            return $content;
        }

        $separator = $this->getSeparator();
        $placement = $this->getPlacement();
        $label     = $this->buildLabel();
        $input	   = $this->buildInput();
        $desc      = $this->buildDescription();

        $output = '<tr><td>'
                . $label. '</td><td>'
                . $input
                . $desc
                . '</td></tr>';
        return  $output;
    }
}

?>